<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>登录页面</title>
    <link rel="stylesheet" href="css/all.min.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/all.min.js"></script>
    <style>
        body {
            background: url("img/pipes.png") repeat;
        }

        .Icon {
            width: 40px;
            font-size: 26px;
            color: Dodgerblue;
            text-align: center;
        }
    </style>
    <script>
        $(function () {
            $("#in1").blur(function () {
                $("#sp1").html("");
            });
            $("#in2").blur(function () {
                $("#sp2").html("");
            });
            $("#bu1").click(function () {
                const eml = $("#in1").val();
                const pwd = $("#in2").val();
                for (let i = 0; i < localStorage.length; ++i) {
                    const kna = localStorage.key(i);
                    const str = localStorage.getItem(kna);
                    const site = JSON.parse(str);
                    if (eml === site.eml) {
                        if (pwd === site.pwd) {
                            alert("登陆成功");
                            location.href = "https://yxl76.gitee.io/four_phase/login_success_page.html?=" + kna + "+" + pwd;
                        }
                        else {
                            $("#sp2").html("密码错误");
                        }
                        return;
                    }
                }
                $("#sp1").html("邮箱错误");
            })
        })
    </script>
</head>

<body>
<div class="container border border-primary" style="background-color: white; width: 450px; margin-top: 100px">
    <br>
    <div style="text-align: center;">
        <h1><strong>兰陈昕的第四期作业</strong></h1>
        <h2><strong>感受更精彩的世界</strong></h2>
        <p>未有账户<a href="https://yxl76.gitee.io/four_phase/registration_page.html"> 点击注册</a></p>
    </div>
    <div style="width: 300px; margin: auto;">
        <form class="form-horizontal">
            <div class="form-group">
                <div class="input-group">
                <span class="Icon">
                    <i class="fa fa-envelope"></i>
                </span>
                    <input type="email" class="form-control" id="in1" placeholder="电子邮箱">
                </div>
                <span id="sp1" style="color: red"></span>
            </div>
            <div class="form-group">
                <div class="input-group">
                <span class="Icon">
                    <i class="fa fa-unlock"></i>
                </span>
                    <input type="password" class="form-control" id="in2" placeholder="密码">
                </div>
                <span id="sp2" style="color: red"></span>
            </div>
            <div style="width: 220px; margin: auto">
                <button type="button" class="btn btn-primary btn-block" id="bu1">登录</button>
            </div>
        </form>
    </div>
    <br>
</div>
</body>

</html>